<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>{{ user.username }}的主页</title>
    <link rel="stylesheet" type="text/css" href="{% static 'css/bootstrap.min.css' %}">
    <link rel="stylesheet" href="{% static 'css/user_center.css' %}">
    <link rel="stylesheet" href="{% static 'css/head.css' %}">
    <link rel="stylesheet" href="{% static 'css/file.css' %}">
    <style>
        .list_body {
            display: flex;
            justify-content: center;
            align-items: center;
            flex-direction: column;
            min-height: 60vh;
        }
    </style>
</head>
<body>
    <div class="nav_head">
        <div class="container">
            {% if request.session.username|default:'' != '' %}
                <p>欢迎您，{{ request.session.username }}</p>
                <button class="btn btn-default"><a href="/user/logout">退出</a></button>
            {% else %}
                <a class="btn btn-link" href="/user/login">登陆</a>
                <a class="btn btn-link" href="/user/register">注册</a>
            {% endif %}
            <div class="nav dropdown">
                <a class="btn btn-link" href="/user/user_center">| 用户中心</a>
            </div>
            <div class="nav">
                <a class="btn btn-link" href="/">首页</a>
            </div>
        </div>
    </div>
    <div class="title">
        <div class="container">
            <img src="{% static 'img/title.png' %}">
            <div class="second_title">
                <div class="find">
                    <input type="text" class="form-control" id="search">
                    <a type="button" class="btn btn-warning" id="search-button" href="javascript:void(0);" onclick="go_search()">
                        <span class="glyphicon glyphicon-search"></span>
                    </a>
                    <button type="button" class="btn btn-warning"><a href="/release_goods">发布闲置</a></button>
                </div>
            </div>      
        </div>
    </div>
    <!-- 返回最上开始 -->
    <div class="back_to_top">
        <a href="#"><img src="{% static 'img/index-回到最上.png' %}"></a>
    </div>
    <!-- 返回最上结束 -->
    <div class="list">
        <div class="container">
            <div class="list_body text-center">
                <p class="text-center">{{ user.username }}的主页</p>
                <hr>
                <p>用户名: 
                    {% if user.username %}
                        {{ user.username }}
                    {% else %}
                        <span style="color: red;">用户名不存在</span>
                    {% endif %}
                </p>
                
                <p>学号: 
                    {% if user.number %}
                        {{ user.number }}
                    {% else %}
                        <span style="color: red;">学号不存在</span>
                    {% endif %}
                </p>
                
                <p>邮箱: 
                    {% if user.email %}
                        {{ user.email }}
                    {% else %}
                        <span style="color: red;">邮箱尚未填写</span>
                    {% endif %}
                </p>
                
                <p>个人描述: 
                    {% if user.description %}
                        {{ user.description }}
                    {% else %}
                        <span style="color: red;">个人描述尚未填写</span>
                    {% endif %}
                </p>
            </div>
        </div>
    </div>

    <script src="{% static 'js/jquery-3.3.1.min.js' %}"></script>
    <script src="{% static 'js/bootstrap.min.js' %}"></script>
    <script src="{% static 'js/user_center.js' %}"></script>
    <script src="{% static 'js/file.js' %}"></script>
    {% include 'includes/websocket.html' %}
</body>
</html>